﻿#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QThread>
#include <QSystemTrayIcon>
#include <QTimer>
#include <QMenu>
#include <QAction>
#include <QFile>
#include <QCloseEvent>
#include <QTableWidgetItem>
#include <QColor>
#include "tbworker.h"

namespace Ui {
class Widget;
}

class Widget : public QWidget
{
    Q_OBJECT

public:
    explicit Widget(QWidget *parent = 0);
    ~Widget();

protected:
    void closeEvent(QCloseEvent * e );
    void keyReleaseEvent(QKeyEvent *event);

private:
    Ui::Widget *ui;
    QThread * m_sub_thread;
    tbWorker *m_tbWorker;
    QSystemTrayIcon * m_systemTray;
    QMenu * m_systemTrayMenu;
    QAction * m_actionQuit;
    QAction * m_actionShowWindow;
    QTimer * m_timer_monitor;
    QFile  m_loger;
    QString m_logdir;
    bool m_enable_refresh;      //手动执行标志



private:
    void m_set_system_tray();
    void m_set_table_title();
    void m_init_data();
    void m_set_table_content(QByteArray reply);
    void m_Quit();
    void m_show_window();
    void m_active_tray(QSystemTrayIcon::ActivationReason reason);
    void m_time_out_monitor();
    void m_init_log();
    void m_write_log(const QString &logStr);
    void m_handleWorkerError(const QString &errorStr);

signals:
    void start_check();
    void perform_zjjk_check();
    void perform_ask_check();
    void perform_a13_check();
    void perform_note_check();

};

#endif // WIDGET_H
